#!/bin/bash

#################################################
### Run this script to configure dynamically added
### memory (ESX virtual machines)
#
# Christopher D. DeVille
#################################################


if (( ${UID} != 0 ))
        then echo "ERROR: You must be root to run this script!"
        exit 1
fi

for x in $(ls -d /sys/devices/system/memory/memory*)
        do 
        STATEFILE=${x}/state
        if [[ $(cat ${STATEFILE}) != "online" ]]
                then echo "${STATEFILE} -- Updating..." 
		echo "online" > ${STATEFILE}
        fi
done

